import { type RouteRecordRaw} from "vue-router";
import StudentView from "@/views/Student/Index.vue";
//学习中心视图组件导入
import LearnView from "@/views/Student/learn/Home/Index.vue";
import LearnContent from "@/views/Student/learn/Home/component/Conetnt.vue";
import Curriculum from "@/views/Student/learn/Curriculum/Index.vue";
import Forum from "@/views/Student/learn/Forum/Index.vue";
import Model from "@/views/Student/learn/Model/Index.vue";
import UseModel from "@/views/Student/UseModel/Index.vue";
import ShowModel from "@/views/Student/ShowModel/Index.vue"
import NoteView from "@/views/Student/note/Home/Index.vue";
import NoteAboutView from "@/views/Student/note/Home/About.vue"
import NotePersonalView from "@/views/Student/note/Personal/Index.vue"
import NoteCourseView from "@/views/Student/note/Course/Index.vue"
import PersonalView from "@/views/Student/personal/Index.vue";
import PersonalHomeView from "@/views/Student/personal/Home/Index.vue";
import ModifyInfo from "@/views/Student/personal/ModifyInfo/Index.vue"
//公共文章、课程读、写操作页面
import ReadPage from "@/views/Student/Read/Index.vue"
import WritePage from "@/views/Student/Write/Index.vue"
const studentRouter:Array<RouteRecordRaw> = [
    {
        path: '/student',
        name: 'Student',
        component: StudentView,
        redirect: ():string => '/learn',
        meta: {requiresAuth: true, roles: ['student']},
        children:[
            {
                path:'/learn',
                name:'Learn',
                component: LearnView,
                redirect: ():string => '/learn-index',
                meta: {requiresAuth: true, roles: ['student']},
                children: [
                    {
                        path: '/learn-index',
                        name: 'LearnIndex',
                        component: LearnContent,
                        meta: {requiresAuth: true, roles: ['student']},
                    },
                    {
                        path: '/curriculum',
                        name: 'Curriculum',
                        component: Curriculum,
                        meta: {requiresAuth: true, roles: ['student']},
                    },
                    {
                        path: '/forum',
                        name: 'Forum',
                        component: Forum,
                        meta: {requiresAuth: true, roles: ['student']},
                    },
                    {
                        path: '/model',
                        name: 'Model',
                        component: Model,
                        meta: {requiresAuth: true, roles: ['student']},
                    },
                ]
            },
            {
                path: '/note',
                name:'Note',
                component: NoteView,
                redirect: ():string => '/note/about',
                meta: {requiresAuth: true, roles: ['student']},
                children: [
                    {
                        path: '/note/about',
                        name: 'NoteAbout',
                        component: NoteAboutView,
                        meta: {requiresAuth: true, roles: ['student']},
                    },
                    {
                        path: '/note/personal',
                        name: 'NotePersonal',
                        component: NotePersonalView,
                        meta: {requiresAuth: true, roles: ['student']},
                    },
                    {
                        path: '/note/course',
                        name: 'NoteCourse',
                        component: NoteCourseView,
                        meta: {requiresAuth: true, roles: ['student']},
                    }
                ]
            },
            {
                path: '/personal',
                name:'Personal',
                component: PersonalView,
                redirect: ():string => '/personal/about',
                meta: {requiresAuth: true, roles: ['student']},
                children: [
                    {
                        path: '/personal/about',
                        name: 'PersonalView',
                        component: PersonalHomeView,
                        meta: {requiresAuth: true, roles: ['student']},
                    },
                    {
                        path: '/personal/update',
                        name: 'ModifyInfo',
                        component: ModifyInfo,
                        meta: {requiresAuth: true, roles: ['student']},
                    },
                ]
            }
        ]
    },
    {
        path: '/use-model',
        name: 'UseModel',
        component: UseModel,
        meta: {requiresAuth: true, roles: ['student']},
    },
    {
        path: '/show-model/:name',
        name: 'ShowModel',
        component: ShowModel,
        meta: {requiresAuth: true, roles: ['student']},
    },
    {
        path: '/write',
        name: 'WritePage',
        component: WritePage,
        meta: {requiresAuth: true, roles: ['student']},
    },
    {
        path: '/read',
        name: 'ReadPage',
        component: ReadPage,
        meta: {requiresAuth: true, roles: ['student']},
    }
]
export default studentRouter
